#include <iostream>
using namespace std;

class A {
  static int count;
  int c;
  int aa;
public:
  A(){c=count++;cout<<"A()"<<c<<endl;}
  ~A(){cout<<"~A()"<<c<<endl;}
  void set(int a){aa = a;}
  int get()const{return aa;}
};
int A::count = 0;
A foo(const A& a){
  cout<<"----"<<endl;
  A b;
  b.set(a.get());
  cout<<"----"<<endl;
  return b;
}

int main()
{
  foo(A());//bad programming style

  return 0;
}
